package app.caihan.scframe.common.loadinghelper

import android.view.MenuItem
import androidx.annotation.ColorRes
import app.caihan.scframe.R
import app.caihan.scframe.base.activity.BaseVmActivity
import kotlin.jvm.functions.Function1
import kotlin.reflect.KFunction0


/**
 * @param type 框架自带的toolbar类型[ToolbarType],在[BaseVmActivity.setBaseToolbar]中调用,判断绑定的toolbar类型
 * @param title 框架自带的toolbar的标题,默认叫"ScFrame",表示不使用框架自带的toolbar
 * @param onBackClick 返回键响应事件,如果UI层需要自行处理的话则传入相关方法,[this::onNavBackClick]
 * @param navIconType 是否显示返回键,模式是[NavIconType.BACK]显示
 * @param isLightMode 状态栏字体颜色,true=状态栏黑色字体,false=状态栏白色字体(系统默认)
 * @param statusBarColor 状态栏的背景色
 * @param isSupportScroll 用于BaseToolbarAdapter,如果UI布局中存在rv的话,请务必传false
 * @param menuId 菜单id,用于触发[toolbar.inflateMenu(menuId)]
 * @param onMenuItemClick 菜单点击响应事件,用于触发[toolbar.setOnMenuItemClickListener(OnMenuItemClickListener listener)]
 */
data class ToolbarConfig @JvmOverloads constructor(
    val type: ToolbarType = ToolbarType.APPBAR,
    val title: String = "ScFrame",
    val onBackClick: KFunction0<Unit>? = null,
    val navIconType: NavIconType = NavIconType.BACK,
    val isLightMode: Boolean = false,
    @ColorRes val statusBarColor: Int = R.color.colorMain,
    val isSupportScroll: Boolean = false,
    val menuId: Int = 0,
    val onMenuItemClick: Function1<MenuItem, Boolean>? = null
) {
    var isUseBaseToolbar = false
        get() {
            return title.isNotEmpty() && "ScFrame" != title
        }
}